package zzx.ccf_201312;

import java.util.Arrays;
import java.util.Scanner;

public class MaxFrequency {
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int n,i,j,max,local=0;
		n=scanner.nextInt();
		int a[]=new int[n];
		for ( i = 0; i < n; i++) {
			a[i]=scanner.nextInt();
		}
		Arrays.sort(a);
		int b[]=new int[n];
		for ( i = 0; i < n; i++) {
			for ( j =0;j!=i&&j < n; j++) {
				if (a[i]==a[j]) {
					b[i]++;   //记录a[i]中每个数出现次数
				}
			}
		}
		max=b[0];
		for ( i = 1; i < n; i++) {
			if (max<b[i]) {
				max=b[i];
				local=i;
			}
		}
		System.out.println(a[local]);
	}
}
